package com.szu.subject.ui.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.szu.subject.domains.User;
import com.szu.subject.ui.mapper.UserMapper;
import com.szu.subject.ui.service.UserService;

/**
 * account的service层的实际实现类
 * 
 * @author Shenxiaolin
 *
 */
@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserMapper userMapper;

	@Override
	public User getUserByPK(Long id) {
		return userMapper.getUserByPK(id);
	}

	@Transactional
	@Override
	public User createUser(User user) {
		userMapper.createUser(user);
		return user;
	}

	@Transactional
	@Override
	public User updateUser(User user) {
		userMapper.updateUser(user);
		return user;
	}

	@Transactional
	@Override
	public int deleteUser(Long id) {
		return userMapper.deleteUser(id);
	}

	@Transactional
	@Override
	public List<User> batchCreateUsers(List<User> users) {
		userMapper.batchCreateUsers(users);
		return users;
	}

	@Transactional
	@Override
	public List<User> batchUpdateUsers(List<User> users) {
		userMapper.batchUpdateUsers(users);
		return users;
	}

	@Transactional
	@Override
	public int batchDeleteUsers(List<Long> ids) {
		return userMapper.batchDeleteUsers(ids);
	}


	@Override
	public List<User> getAllUsers() {
		return userMapper.getAllUsers();
	}

	@Override
	public User getUserByAccount(String account) {
		return userMapper.getUserByAccount(account);
	}

}
